#pragma once

#ifndef MENUS_H
#define MENUS_H

#include <d3d9.h>
#include <d3dx9.h>
#include "Collision.h"
#include "Message.h"

class Menus
{
private:
	// Holds the background. 
	D3DXVECTOR3 bgPosition;
	// Holes the position of the menu image.
	D3DXVECTOR3 slidePos;
	// Holds the background texture.
	IDirect3DTexture9* bgTexture;
	// Holds the slide textures.
	IDirect3DTexture9* slide1;
	IDirect3DTexture9* slide2;
	IDirect3DTexture9* slide3;
	// Holds the current slide number.
	int currentSlide;
public:
	Menus(IDirect3DTexture9* background, IDirect3DTexture9* slide1,
		IDirect3DTexture9* slide2, IDirect3DTexture9* slide3)
	{
		bgPosition = D3DXVECTOR3(0, 0, 0);
		slidePos = D3DXVECTOR3(254, 180, 0);
		this->bgTexture = background;
		this->slide1 = slide1;
		this->slide2 = slide2;
		this->slide3 = slide3;
		this->currentSlide = 1;
	}
	// Get & set the current slide number.
	int getCurrentSlide() { return currentSlide; }
	void setCurrentSlide(int newCurrentSlide) { currentSlide = newCurrentSlide; }
	void draw(ID3DXSprite* sprite)
	{
		// Always draw the background.
		sprite->Draw(bgTexture, 0, 0, &bgPosition, D3DCOLOR_XRGB(255,255,255));
		// Draw the current slide.
		switch (currentSlide)
		{
		case 1:
			sprite->Draw(slide1, 0, 0, &slidePos, D3DCOLOR_XRGB(255,255,255));
			break;
		case 2:
			sprite->Draw(slide2, 0, 0, &slidePos, D3DCOLOR_XRGB(255,255,255));
			break;
		case 3:
			sprite->Draw(slide3, 0, 0, &slidePos, D3DCOLOR_XRGB(255,255,255));
			break;
		default:
			currentSlide = 1;
			break;
		}
	}
	~Menus()
	{
		// Unload textures used in the menu object.
		bgTexture->Release();
		bgTexture = 0;
		slide1->Release();
		slide1 = 0;
		slide2->Release();
		slide2 = 0;
		slide3->Release();
		slide3 = 0;
	}
};

#endif